﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PwjCy.Lite.EntityLite
{
    /// <summary>
    /// DAO对象接口
    /// </summary>
    public interface IPwjCyObject
    {
        /// <summary>
        /// 创建时间
        /// </summary>
        DateTime CreatedTime { get; }
        /// <summary>
        /// 修改时间
        /// </summary>
        DateTime ModifyTime { get; }
        /// <summary>
        /// 操作类型(新增，修改，删除)
        /// </summary>
        ObjectOperateType ObjectOperateType { get; }
        /// <summary>
        /// 事务类型
        /// </summary>
        ObjectTranscopeType ObjectTranscopeType { get; }
        /// <summary>
        /// 主键
        /// </summary>
        object Id { get; set; }
        /// <summary>
        /// StringId
        /// </summary>
        string StringId { get; }
        /// <summary>
        /// 版本号
        /// </summary>
        int Version { get; set; }
        /// <summary>
        /// 表名
        /// </summary>
        string TableName { get; set; }
        /// <summary>
        /// 存储别名
        /// </summary>
        string StorageAlias { get; set; }
        /// <summary>
        /// 删除当前数据
        /// </summary>
        void Remove();

    }
    /// <summary>
    /// 对象操作类型
    /// </summary>
    public enum ObjectOperateType
    {
        Create = 1,//新增
        Update = 2,//更新
        Delete = 3,//删除
    }
    /// <summary>
    /// 事务类型(值越大,优先级越高)
    /// </summary>
    public enum ObjectTranscopeType
    {
        None = 1,//无事务
        DbTransaction = 2,//单库事务
        TransactionScope = 3,//跨库事务
    }
}
